﻿@using BankCreditPortfolio.DAL.Services
@model BankCreditPortfolio.Models.ClientCabinetModels.NextPaymentsModel
@{
    ViewBag.Title = "Next Payments";
}
<strong>Payments on Credit</strong>
<p>
    Here you can find information about the next payments.</p>
<script src="@Url.Content("~/Scripts/jquery.validate.min.js")" type="text/javascript"></script>
<script src="@Url.Content("~/Scripts/jquery.validate.unobtrusive.min.js")" type="text/javascript"></script>
<link href="@Url.Content("~/Content/Styles/forms.css")" rel="stylesheet" type="text/css" />
@{
    if (Model.Error != null)
    {
    @Html.DisplayTextFor(m => m.Error)
    }
}
@using (Html.BeginForm())
{        
    <fieldset>
        <legend>Payments</legend>
        <div class="editor-label">
            @Html.LabelFor(m => m.NextPayment)
        </div>
        <div class="editor-field-text">
            @Html.DisplayTextFor(m => m.NextPayment)
        </div>
        <div class="editor-label">
            @Html.LabelFor(m => m.NextPaymentAmount)
        </div>
        <div class="editor-field-text">
            @Html.DisplayTextFor(m => m.NextPaymentAmount)
        </div>
        @{ if (Model.Fine != 0)
           {
            <div id="fineid">
                <div class="editor-label">
                    @Html.LabelFor(m => m.Fine) - @((new TariffService()).Find(Model.TariffId).Fine)
                    %
                </div>
                <div class="editor-field-text">
                    @Html.DisplayTextFor(m => m.Fine)
                </div>
            </div>
           } }
        @{ if (Model.Pay)
           {<br />
            <div>
               @Html.ActionLink("PAY", "CreditPay", new
          {
              amount = Model.NextPaymentAmount + Model.Fine,
              agreementId = Model.AgreementId
          })
           </div>}
           else
           {<div id="penaltyid">
                    <div class="editor-label">
                        @Html.LabelFor(m => m.PrePaymentPenalty) (penalty for pre-term payment is @((new TariffService()).Find(Model.TariffId).EarlyRepaymentFine) %)
                    </div>
                    <div class="editor-field-text">
                        @Html.DisplayTextFor(m => m.PrePaymentPenalty)
                    </div>
                </div>
             <br />
            <div>
                @Html.ActionLink("Pre-term PAY", "CreditPay", new
           {
               amount = Model.NextPaymentAmount + Model.PrePaymentPenalty,
               agreementId = Model.AgreementId
           }) 
            </div>}
        }
    </fieldset> 
    <div>
        <div class="editor-label">
            @Html.LabelFor(m => m.PreRepayPenalty) (penalty for pre-term repay is @((new TariffService()).Find(Model.TariffId).EarlyRepaymentFine) %)
        </div>
        <div class="editor-field-text">
            @Html.DisplayTextFor(m => m.PreRepayPenalty)
        </div>
    </div>
    <br />
    <div>
        @Html.ActionLink("Pre-term Credit REPAY", "CreditRepay", new
   {
       amount = Model.Amount + Model.PreRepayPenalty,
       agreementId = Model.AgreementId
   }) 
    </div>
}